<#assign tablerole=auth.getuuid()>
<#assign formid=auth.getuuid()>
<#assign rolegetmenutree=auth.getuuid()>
<#assign rolegetusertree=auth.getuuid()>
<#assign rolename1=auth.getuuid()>
<#assign rolename2=auth.getuuid()>


<script type="text/javascript">
function savetable(){
	$.CurrentNavtab.find('#${formid}').submit();
}
var groleid = "";
$(function(){
	$("#${tablerole}").find("tbody > tr").bind("click",function(){
		var roleid = $($(this).find("input")[0]).val();
		var rolename = $($(this).find("input")[1]).val();
		if(groleid!=roleid){
			$('#${formid}').bjuiajax('doLoad', {url:"${rootpath}/System/role_getmenu?roleid="+roleid, target:"#${rolegetmenutree}"});
			$('#${formid}').bjuiajax('doLoad', {url:"${rootpath}/System/role_getuser?roleid="+roleid, target:"#${rolegetusertree}"});
			$('#${rolename1}').text("【"+rolename+"】用户");
			$('#${rolename2}').text("【"+rolename+"】菜单");
			groleid = roleid;
		}
	});
});


</script>
<div class="bjui-pageHeader">
	<form id="pagerForm" data-toggle="ajaxsearch" action="${rootpath}/System/role" method="post">
        <input type="hidden" name="pageSize" value="${(page.pageSize)!30}">
        <input type="hidden" name="pageCurrent" value="${(page.pageCurrent)!1}">
        <input type="hidden" name="orderField" value="${(page.orderField)!"name"}">
        <input type="hidden" name="orderDirection" value="${(page.orderDirection)!"asc"}">
        
        <div class="bjui-searchBar">
        	<#if auth.getauth(userid,"/System/role_save")>
        	<button type="button" class="btn-green" data-toggle="tableditadd" data-target="#${tablerole}" data-num="1" data-icon="plus">添加行</button>&nbsp;
            <button type="button" class="btn-blue" onclick="savetable();" data-icon="save">保存修改</button>&nbsp;
            </#if>
            <label>ID：</label><input type="text" value="${id!}" name="id" size="10" />&nbsp;
            <label>名称：</label><input type="text" value="${name!}" name="name" size="8" />&nbsp;
            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <a class="btn btn-orange" href="javascript:;" onclick="$(this).navtab('reloadForm', true)" data-icon="undo">清空查询</a>&nbsp;
            <div class="alert alert-info search-inline"><i class="fa fa-info-circle"></i> 双击行可编辑</div>&nbsp;
            <div class="pull-right">
                
            </div>
        </div>
        
    </form>
</div>
<div class="bjui-pageContent tableContent">
	<div class="col-md-6">
	    <form action="${rootpath}/System/role_save" id="${formid}" class="pageForm" data-toggle="validate" method="post">
	        <table id="${tablerole}" class="table table-bordered table-hover table-striped table-top" data-toggle="tabledit" data-initnum="0">
	            <thead>
	                <tr>
	                    <th data-order-field="id" title="ID"><input type="text" name="#index#*id" readonly value="" size="10"></th>
	                    <th data-order-field="name" title="名称"><input type="text" name="#index#*name" data-rule="required" value="新角色名称" size="90"></th>
	                	
	                	<th title="操作" data-addtool="true" width="100">
	                		<#if auth.getauth(userid,"/System/role_save")>
	                		<a href="javascript:;" class="btn btn-red row-del" data-confirm-msg="确定要删除该行信息吗？">删除</a>
	                		</#if>
	                	</th>
	                	<th  style="display:none;" title="_rowstatus"><input type="text" name="#index#*_rowstatus" value="Normal"></th>
	                </tr>
	            </thead>
	            <tbody>
	                <#if (page.pageData)?exists>
		                <#list page.pageData as item>
		                	<#if item?exists>
		                		<tr data-id="${item.id!}">
					                <td>${item.id!}</td>
					                <td>${item.name!}</td>
					                <td data-noedit="true">
					                	<#if auth.getauth(userid,"/System/role_save")>
	                        			<a href="javascript:;" class="btn btn-red row-del" data-confirm-msg="确定要删除该行信息吗？">删除</a>
	                    				</#if>
	                    			</td>
	                    			<td style="display:none;">Normal</td>
					            </tr>
		                	</#if>
		                </#list>
	            	</#if>
	            </tbody>
	        </table>
	 	</form>
	</div>
	<div class="col-md-3" style="margin-top: 10px;">
		<fieldset>
            <legend id="${rolename1}">用户</legend>
            	<div id="${rolegetusertree}" class="bjui-layout" style="height:625px;overflow: auto;">
            		单击表格行显示数据
                </div>
        </fieldset>
	</div>
	<div class="col-md-3" style="margin-top: 10px;">
		<fieldset>
            <legend id="${rolename2}">菜单</legend>
            	<div id="${rolegetmenutree}" class="bjui-layout" style="height:625px;overflow: auto;">
            		单击表格行显示数据
                </div>
        </fieldset>
		
	</div>
    <div class="bjui-pageFooter">
		<div class="pages">
			<span>每页&nbsp;</span>
			<div class="selectPagesize">
				<select data-toggle="selectpicker" data-defval="${page.pageSize!}" data-toggle-change="changepagesize" >
		    		<option value="15">15</option>
		        	<option value="30">30</option>
		        	<option value="50">50</option>
		        	<option value="100">100</option>
		    	</select>
			</div>
			<span>&nbsp;条，共 ${(page.totalRow)!0} 条</span>
		</div>
		<div class="pagination-box" data-toggle="pagination" data-total="${(page.totalRow)!0}" data-page-size="${(page.pageSize)!30}" data-page-current="${(page.pageCurrent)!1}">
		</div>
	</div>
</div>




